<style>
.smallChildDiv{
	display:block;
}
#productLeft{
	float:none;
	border:1px #C2D8FE solid;
	width:97%;
	padding:10px;
}
#productLeft a{
	font-size:13px;
	background:none;
}
.flLable{
	color:#999999;
	text-decoration:none;
}
	.flLable:hover{
		color:#cccccc;
		font-size:15px;
	}

.headflDiv{
	background:url(html/images/topicsbg.gif) repeat-x bottom;
	height:25px;
	padding:5px 5px 0px 5px;
	text-align:left;
}
.middleflDiv{
	padding:10px;
	
}
.tailflDiv{
	text-align:center;
	padding:10px;
}
</style><script>upload.type='product';upload.formid='addProductForm';fenleiEffection.type='product';fenleiEffection.optionString='请选择产品分类';function move(obj){	if(obj==''){		return;	}	var oList1=document.getElementById("oListbox1");	var oList2=document.getElementById("oListbox2");	var price =document.getElementById("price");	var arrOptions=new Array;	if(obj=="add"){		if(oList1.options.length<=0){			alert("左边已经没有了");			return;		}	if(oList1.selectedIndex<0){alert("请选择要删除的项");return;}for(var i=0;i<oList1.options.length;i++){	if(oList1.options[i].selected){		//将当前选中的添加到数组中		if(price.value.length<=0){			alert("请填写价格");			return;		}		oList1.options[i].text = oList1.options[i].text +"%%%"+price.value;		oList1.options[i].value = oList1.options[i].value +"%%%"+price.value;		arrOptions.push(oList1.options[i]);	}}for(var i=0;i<arrOptions.length;i++){	//循环把数组中的值添加的oList2	oList2.appendChild(arrOptions[i]);}}else if(obj=="delete"){if(oList2.options.length<=0){alert("右边已经没有了");return;}if(oList2.selectedIndex<0){alert("请选择要删除的项");return;}for(var i=0;i<oList2.options.length;i++){if(oList2.options[i].selected){	oList2.options[i].text = oList2.options[i].text.substring(0,oList2.options[i].text.indexOf("%%%"));	oList2.options[i].value = oList2.options[i].value.substring(0,oList2.options[i].value.indexOf("%%%"));	arrOptions.push(oList2.options[i]);}}for(var i=0;i<arrOptions.length;i++){oList1.appendChild(arrOptions[i]);}}}</script>
<script>
fenleiEffection.showOrHide=function(){
	return false;
}

function checkForm(){
	if(trim($('input[name="flname"]').val())==''){
		alert('请输入新分类名称!');
		return false;
	}
	$('#centerFlForm').submit();
}

var kuangManagement={
	kuang:new Object(),
	createKuang:function(thisA){
		var thisTishiKuang=getCenterDiv(700,130,175,70,'thisTishiKuang');
		var point=fGetXY(thisA);
		showBack();
		document.getElementsByTagName("body")[0].appendChild(thisTishiKuang);
		$('#thisTishiKuang').css('left','10px');
		$('#thisTishiKuang').css('top',parseInt(point.y)+'px');
		$('#thisTishiKuang').fadeIn('slow');
		$('#thisTishiKuang').css('paddingTop','0px');
		$('#thisTishiKuang').css('height','1200px');
		this.kuang=thisTishiKuang;
	},
	shutKuang:function(){
		shutBack();
		$(this.kuang).remove();
	}
};

var myCenterDiv={
	headTitle:'',
	action:'',
	centerString:'',	setAccessory:function(){		$.get("/administrator-fenlei-getaccessory",function(data){			var dataObj=eval("("+data+")");			var assssoryHtml = '';			for(a in dataObj){				assssoryHtml +='<option value='+dataObj[a]['itemid']+'>'+dataObj[a]['subject']+'</option>';			}			 $("#oListbox1").html(assssoryHtml);		});	},	
	setCenterDiv:function(){

		this.centerString='<div class="centerflDiv" align="left" style="height: 1600px;">';
		this.centerString+='<form name="centerFlForm" id="centerFlForm" method="post" action="'+this.action+'">';
		this.centerString+='<div class="headflDiv"><a style="float:right" onclick="kuangManagement.shutKuang();">关闭</a>'+this.headTitle+'</div>';
		this.centerString+='<div class="middleflDiv">新分类英文名：<input name="en_flname" type="text" /></div>';
		this.centerString+='<div class="middleflDiv">新分类中文名：<input name="flname" type="text" /></div>';		this.centerString+='<div class="middleflDiv">关键词&nbsp; &nbsp; &nbsp; &nbsp;  ：<input name="keywords" type="text" /></div>';		this.centerString+='<div class="middleflDiv">Title&nbsp; &nbsp; &nbsp; &nbsp;  ：<input name="title" type="text" /></div>';		this.centerString+='<div class="middleflDiv">分类描述：<textarea name="description" style="width:300px; height: 100px"></textarea></div>';
		this.centerString+='<div class="middleflDiv">描述：<br><textarea name="flbody" id="flbody" cols="60" rows="12" style="display:none"></textarea><input type="hidden" id="flbody___Config" value="" style="display:none" /><iframe id="flbody___Frame" src="/fckeditor/editor/fckeditor.html?InstanceName=flbody&amp;Toolbar=Default" width="98%" height="400" frameborder="0" scrolling="no"></iframe></div>';		
               /// this.centerString+='<div class="middleflDiv">Logo：<span><input name="productpic" type="file" id="productpic" /></span>　<input type="button" onclick="upload.uploadimg(this);" value="上传" /></div>';
               /// this.centerString+='<div class="middleflDiv"><div id="productImages"></div><iframe id="productIframe" width="0" height="0" name="productIframe"></iframe></div>';		this.centerString+='<div class="middleflDiv"><img src="html/images/administrator/add_product_item.jpg" /> <img src="html/images/administrator/product_9.gif" /> <strong>添加配件</strong></div>';		this.centerString+='<div class="middleflDiv"><table width="460" border="0" class="zhcx" cellpadding="0" cellspacing="0">';		this.centerString+='<tr><td><select name="oListbox1" size="18" style="width:300px;" multiple="multiple" id="oListbox1"></select></td><td> &nbsp;<input type="text" size=5 class="zhcxbtn" name="price" id="price">';		this.centerString+='<br>&nbsp;<input type="button" class="zhcxbtn" value=" &gt; " onclick="move(\'add\');selectAll();"/>&nbsp;<br />&nbsp;<input type="button" class="zhcxbtn" value=" &lt; " onclick="move(\'delete\');selectAll();"/> &nbsp;</td>';		this.centerString+='<td><select name="interrelated[]" size="18" style="width:300px;" multiple="multiple" id="oListbox2"></select></td><td></td></tr></table></div>';
        this.centerString+='<div class="middleflDiv">是否公开：<select name="openflag" id="openflag"><option value="1">是</option><option value="0">否</option></select></div>';				                
        this.centerString+='<div class="tailflDiv"><input onclick="checkForm();" type="button" value="确定" /></div>';
		this.centerString+='</form>';
		this.centerString+='</div>';
	},
	getCenterDiv:function(){
		this.setCenterDiv();
		return this.centerString;
	}
};

var flManagement={
	alterfl:function(thisA){
		kuangManagement.shutKuang();
		kuangManagement.createKuang(thisA);
		myCenterDiv.headTitle="修改分类";
		myCenterDiv.action="administrator<?=CHOSING_DE?>fenlei<?=CHOSING_DE?>alter?type=<?=$this->type?>";
		kuangManagement.kuang.innerHTML=myCenterDiv.getCenterDiv();
		$('input[name="en_flname"]').val($(thisA).prev().prev().html());
		//$('input[name="flname"]').val($(thisA).prev().html());
                //$('textarea[name="flbody"]').val($(thisA).prev().prev().attr('title'));
                $('textarea[name="flbody"]').val($(thisA).prev().html());
                $('input[name="flname"]').val($(thisA).prev().prev().attr('title'));
                $('select[name="openflag"]').val($(thisA).prev().prev().attr('alt'));               
		var flid=$(thisA).prev().prev().attr('name');
		$('#centerFlForm').append('<input type="hidden" value="'+flid+'" name="flid" />');
	},
	newfl:function(thisA){		myCenterDiv.setAccessory();
		kuangManagement.shutKuang();
		kuangManagement.createKuang(thisA);
		myCenterDiv.headTitle="新增分类";
		myCenterDiv.action="administrator<?=CHOSING_DE?>fenlei<?=CHOSING_DE?>new?type=<?=$this->type?>";
		kuangManagement.kuang.innerHTML=myCenterDiv.getCenterDiv();	
		if($(thisA).attr('name')=='root'){
			var flid=0;
		}else{
			//$('input[name="flname_cn"]').val($(thisA).prev().prev().html());
			var flid=$(thisA).prev().prev().prev().attr('name');
		}
		$('#centerFlForm').append('<input type="hidden" value="'+flid+'" name="flid" />');
	},
	delfl:function(thisA){
		if(!confirm('确定要删除该分类吗? 删除该分类会将其下的所有子分类都删除!')){
			return false;
		}
		var flid=$(thisA).prev().prev().prev().prev().attr('name');
		window.location.href="administrator<?=CHOSING_DE?>fenlei<?=CHOSING_DE?>dodel?flid="+flid+"&type=<?=$this->type?>";
	}
};


</script>
<div class="frame_fenleiDiv" style="padding-bottom:150px">
	<div id="productLeft">
		<!--<a class="flLable" href="javascript:;" name='root' onclick="flManagement.newfl(this);">新增根分类</a>-->
                <a class="flLable" href="administrator-fenlei-add" name='root'>新增根分类</a>
		<?=$this->fenleiString?>
	</div>
</div>